define(
   [
      'dojo/_base/declare',
      'dojo/_base/lang'
   ],
   function(declare, lang)
   {
      return declare([],
      {
         mUniqueParameterName: 'Id',
         constructor: function(args)
         {
            dojo.safeMixin(this, args);
         },
         postscript: function(args)
         {
            this.inherited(arguments);
      
         },
         newItem: function(pEntry)
         {
            for(var i = 0; i < this.rowCount; i++)
            {
               var item = this.getItem(i);
               if(pEntry[this.mUniqueParameterName] == this.store.getValue(item, this.mUniqueParameterName, ''))
                  return;
      
               i++;
            }
            // clone and add item to store
            var newEntry = dojo.mixin({}, pEntry);
            this.store.newItem(newEntry);
         },
         removeSelectedItems: function(removeItemIsOkCallback, pContextObject)
         {
            var items = this.selection.getSelected();
            dojo.forEach(items, function(pEntry, i)
            {
               if(!pEntry)
                  return;
      
               var removeOk = true;
               if(removeItemIsOkCallback != undefined)
                  removeOk = removeItemIsOkCallback(pEntry, i, pContextObject);
               if(removeOk)
                  this.store.deleteItem(pEntry);
      
            }, this);
         }
      
      });
   }
);
